package com.king.cms.touch.action.front;

import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.hibernate.InstantiationException;

import com.king.cms.action.BaseDispatchAction; 

public class NewsWeatherAction extends BaseDispatchAction{
	private static final Log  log = LogFactory.getLog(NewsWeatherAction.class);
	/**
	 * Method execute
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 * @throws ServletException 
	 * @throws IllegalAccessException 
	 * @throws InstantiationException 
	 * @throws java.lang.InstantiationException 
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws ServletException {
		 String action = request.getParameter("action");
		  
		 if("news".equals(action)){
			 String sql = "select * from cms_touch_news order by PUBLISH_DATE DESC";
			 List newsList = this.getDBOperator(request).select(sql, null);
			 request.setAttribute("mdata", newsList);
			 return mapping.findForward("newsfront");
		 }
		 if("weather".equals(action)){
			 
		 }
		 return null;
	 
	}
}
